// plugin.h
// Max plugin class descriptors

#include <windows.h>
#include "maxinc.h"
#include <vector>
#include <string>
#include <map>

#ifndef _PLUGIN_HEADER_
#define _PLUGIN_HEADER_

class IndentClass
{
public:
	int indent;
	IndentClass() 
	{
		indent = 0;
	}
	void Indent(FILE *fp) 
	{
		for (int i=0; i<indent; i++)
		{
			fprintf(fp, "\t");
		}
	}
};

class SceneyExportPlugin : public SceneExport, public IndentClass
{
private:
	IGameScene *scene;
	FILE *fp;

	std::vector<IGameNode*> mesh_nodes;
	std::vector<IGameNode*> light_nodes;

	void ProcessSingleNode(IGameNode* node);
	void ProcessNode(IGameNode* node);

	void ProcessMaterial(IGameMaterial* mat);

	void ExportMeshes();
	void ExportLights();
	
public:
	
	// constructor
	SceneyExportPlugin();
	~SceneyExportPlugin();

	// Methods required for the plugin
	int	ExtCount();						// Number of extemsions supported
	const TCHAR * Ext(int n);			// Extension #n (i.e. "3DS")
	const TCHAR * LongDesc();			// Long ASCII description (i.e. "Autodesk 3D Studio File")
	const TCHAR * ShortDesc();			// Short ASCII description (i.e. "3D Studio")
	const TCHAR * AuthorName();			// ASCII Author name
	const TCHAR * CopyrightMessage();	// ASCII Copyright message
	const TCHAR * OtherMessage1();		// Other message #1
	const TCHAR * OtherMessage2();		// Other message #2
	unsigned int Version();				// Version number * 100 (i.e. v3.01 = 301)
	void ShowAbout(HWND hWnd);			// Show DLL's "About..." box
	int DoExport(const TCHAR *name, ExpInterface *ei,
		Interface *i, BOOL suppressPrompts = FALSE,
		DWORD options = 0);				// Export file
	BOOL SupportsOptions(int ext, DWORD options); 
										// Returns TRUE if all option bits set are supported for this extension
}; // end class SceneyExportPlugin


// animation exporter
// -------------------
class AnimeyExportPlugin : public SceneExport, public IndentClass
{
private:
	IGameScene *scene;

	FILE *fp;

	void ProcessSingleNode(IGameNode* node);
	void ProcessNode(IGameNode* node);

public:
	
	// constructor
	AnimeyExportPlugin();
	~AnimeyExportPlugin();

	// Methods required for the plugin
	int	ExtCount();						// Number of extemsions supported
	const TCHAR * Ext(int n);			// Extension #n (i.e. "3DS")
	const TCHAR * LongDesc();			// Long ASCII description (i.e. "Autodesk 3D Studio File")
	const TCHAR * ShortDesc();			// Short ASCII description (i.e. "3D Studio")
	const TCHAR * AuthorName();			// ASCII Author name
	const TCHAR * CopyrightMessage();	// ASCII Copyright message
	const TCHAR * OtherMessage1();		// Other message #1
	const TCHAR * OtherMessage2();		// Other message #2
	unsigned int Version();				// Version number * 100 (i.e. v3.01 = 301)
	void ShowAbout(HWND hWnd);			// Show DLL's "About..." box
	int DoExport(const TCHAR *name, ExpInterface *ei,
		Interface *i, BOOL suppressPrompts = FALSE,
		DWORD options = 0);				// Export file
	BOOL SupportsOptions(int ext, DWORD options); 
										// Returns TRUE if all option bits set are supported for this extension
}; // end class AnimeyExportPlugin

// returns the class descriptor
ClassDesc2* GetSceneyExportPluginDesc();
ClassDesc2* GetAnimeyExportPluginDesc();

#endif
